<template>
	<basicContainer>
		<avue-crud :option="option" :data="data" :page="page" ref="crud" @search-change="searchChange" @search-reset="searchReset"
		 @current-change="currentChange" @size-change="sizeChange" @on-load="onLoad">
		</avue-crud>
	</basicContainer>
</template>

<script>
	import request from '@/router/axios';
	export default {
		data() {
			return {
				query: {},
				page: {
					pageSize: 10,
					currentPage: 1,
					total: 0
				},
				option: {
					searchMenuSpan: 4,
					border: true,
					index: true,
					addBtn: false,
					menu: false,
					refreshBtn: false,
					excelBtn: true,
					menuWidth: '150px',
					column: [{
							label: "运单号",
							prop: "logisticsNo",
							searchPlaceholder: '运单号',
							search: true,
							rules: [{
								required: true,
								trigger: "blur"
							}]
						},
						{
							label: "接收时间",
							prop: "createdOn",
							rules: [{
								required: true,
								trigger: "blur"
							}]
						},
						{
							label: "接收人",
							prop: "createdBy"
						},
					]
				},
				data: []
			};
		},
		methods: {
			searchReset() {
				this.query = {};
				this.page.currentPage = 1;
				this.onLoad(this.page);
			},
			currentChange(currentPage) {
				this.page.currentPage = currentPage;
			},
			searchChange(params, done) {
				this.page.currentPage = 1;
				this.query = params;
				this.onLoad(this.page);
				done();
			},
			sizeChange(pageSize) {
				this.page.pageSize = pageSize;
			},
			onLoad(page) {
				request({
					url: '/api/WmsReceive/getpages',
					method: 'get',
					params: {
						key: this.query.logisticsNo == undefined ? '' : this.query.logisticsNo,
						page: page.currentPage,
						limit: page.pageSize
					}
				}).then(res => {
						const data = res.data
						this.data = data.data;
						this.page.total = data.remark;
						console.log(this.page.total);
					}

				);
			}
		}
	};
</script>

<style>
</style>
